import request from '@/utils/request'

// 查询审批流配置列表
export function listApprovalConfig(query) {
  return request({
    url: '/system/approvalConfig/list',
    method: 'get',
    params: query
  })
}

// 查询审批流配置详细
export function getApprovalConfig(id) {
  return request({
    url: '/system/approvalConfig/' + id,
    method: 'get'
  })
}

// 根据模块代码查询审批流配置
export function getApprovalConfigByModule(moduleCode) {
  return request({
    url: '/system/approvalConfig/module/' + moduleCode,
    method: 'get'
  })
}

// 检查模块是否启用审批
export function checkModuleEnabled(moduleCode) {
  return request({
    url: '/system/approvalConfig/enabled/' + moduleCode,
    method: 'get'
  })
}

// 新增审批流配置
export function addApprovalConfig(data) {
  return request({
    url: '/system/approvalConfig',
    method: 'post',
    data: data
  })
}

// 修改审批流配置
export function updateApprovalConfig(data) {
  return request({
    url: '/system/approvalConfig',
    method: 'put',
    data: data
  })
}

// 修改审批流配置状态
export function changeApprovalStatus(data) {
  return request({
    url: '/system/approvalConfig/changeStatus',
    method: 'put',
    data: data
  })
}

// 删除审批流配置
export function delApprovalConfig(id) {
  return request({
    url: '/system/approvalConfig/' + id,
    method: 'delete'
  })
}

// 导出审批流配置
export function exportApprovalConfig(query) {
  return request({
    url: '/system/approvalConfig/export',
    method: 'post',
    params: query
  })
}
